# Contributor: Díaz Urbaneja Diego <sodomon2@gmail.com>
# Maintainer: Díaz Urbaneja Diego <sodomon2@gmail.com>
pkgname=drogon
pkgver=1.9.4
pkgrel=1
pkgdesc="A C++14/17/20 based HTTP web application framework"
url="https://github.com/drogonframework/drogon"
arch="all"
license="MIT"
makedepends="
	brotli-dev
	c-ares-dev
	cmake
	hiredis-dev
	jsoncpp-dev
	mariadb-dev
	libpq-dev
	samurai
	trantor-dev
	util-linux-dev
	sqlite-dev
	yaml-cpp-dev
	"
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/drogonframework/drogon/archive/refs/tags/v$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		local crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=ON \
		-DCMAKE_BUILD_TYPE=Release \
		-DUSE_SUBMODULE=OFF \
		$crossopts
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
0c58ed45aacbfd1916bbd9c52ecbd203abdc1032c7d6f908750a188443e293d749705d35c2b56eab54e30f36cc606b2437889e11a482ebda34d36035e8221499  drogon-1.9.4.tar.gz
"
